// Dynata REX平台支持的语言数据
// 来源: https://docs.rex.dynata.com/rex/markets/
export const supportedLanguages = [
  { codeZ: "ar", nameZ: "Arabic", name_zh: "阿拉伯语" },
  { codeZ: "bn", nameZ: "Bengali", name_zh: "孟加拉语" },
  { codeZ: "bg", nameZ: "Bulgarian", name_zh: "保加利亚语" },
  { codeZ: "zh", nameZ: "Chinese", name_zh: "中文" },
  { codeZ: "hr", nameZ: "Croatian", name_zh: "克罗地亚语" },
  { codeZ: "cs", nameZ: "Czech", name_zh: "捷克语" },
  { codeZ: "da", nameZ: "Danish", name_zh: "丹麦语" },
  { codeZ: "nl", nameZ: "Dutch (Flemish)", name_zh: "荷兰语（佛兰德语）" },
  { codeZ: "en", nameZ: "English", name_zh: "英语" },
  { codeZ: "et", nameZ: "Estonian", name_zh: "爱沙尼亚语" },
  { codeZ: "fi", nameZ: "Finnish", name_zh: "芬兰语" },
  { codeZ: "fr", nameZ: "French", name_zh: "法语" },
  { codeZ: "de", nameZ: "German", name_zh: "德语" },
  { codeZ: "el", nameZ: "Greek", name_zh: "希腊语" },
  { codeZ: "he", nameZ: "Hebrew", name_zh: "希伯来语" },
  { codeZ: "hi", nameZ: "Hindi", name_zh: "印地语" },
  { codeZ: "hu", nameZ: "Hungarian", name_zh: "匈牙利语" },
  { codeZ: "id", nameZ: "Indonesian", name_zh: "印尼语" },
  { codeZ: "it", nameZ: "Italian", name_zh: "意大利语" },
  { codeZ: "ja", nameZ: "Japanese", name_zh: "日语" },
  { codeZ: "kn", nameZ: "Kannada", name_zh: "卡纳达语" },
  { codeZ: "ko", nameZ: "Korean", name_zh: "韩语" },
  { codeZ: "lv", nameZ: "Latvian", name_zh: "拉脱维亚语" },
  { codeZ: "lt", nameZ: "Lithuanian", name_zh: "立陶宛语" },
  { codeZ: "ms", nameZ: "Malay", name_zh: "马来语" },
  { codeZ: "mr", nameZ: "Marathi", name_zh: "马拉地语" },
  { codeZ: "nb", nameZ: "Norwegian (Bokmål)", name_zh: "挪威语（书面挪威语）" },
  { codeZ: "pl", nameZ: "Polish", name_zh: "波兰语" },
  { codeZ: "pt", nameZ: "Portuguese", name_zh: "葡萄牙语" },
  { codeZ: "ro", nameZ: "Romanian", name_zh: "罗马尼亚语" },
  { codeZ: "ru", nameZ: "Russian", name_zh: "俄语" },
  { codeZ: "sr", nameZ: "Serbian", name_zh: "塞尔维亚语" },
  { codeZ: "sk", nameZ: "Slovak", name_zh: "斯洛伐克语" },
  { codeZ: "sl", nameZ: "Slovenian", name_zh: "斯洛文尼亚语" },
  { codeZ: "es", nameZ: "Spanish", name_zh: "西班牙语" },
  { codeZ: "sw", nameZ: "Swahili", name_zh: "斯瓦希里语" },
  { codeZ: "sv", nameZ: "Swedish", name_zh: "瑞典语" },
  { codeZ: "ta", nameZ: "Tamil", name_zh: "泰米尔语" },
  { codeZ: "th", nameZ: "Thai", name_zh: "泰语" },
  { codeZ: "tr", nameZ: "Turkish", name_zh: "土耳其语" },
  { codeZ: "vi", nameZ: "Vietnamese", name_zh: "越南语" },
  { codeZ: "af", nameZ: "Afrikaans", name_zh: "南非荷兰语" }
]

// 根据国家代码获取支持的语言
export const getLanguagesByCountry = (countrycodeZ) => {
  const countryLanguageMap = {
    "AR": ["es"], // Argentina - Spanish
    "AU": ["en"], // Australia - English
    "AT": ["de"], // Austria - German
    "BE": ["fr", "nl"], // Belgium - French, Dutch (Flemish)
    "BR": ["pt"], // Brazil - Portuguese
    "BG": ["bg"], // Bulgaria - Bulgarian
    "CA": ["en", "fr"], // Canada - English, French
    "CL": ["es"], // Chile - Spanish
    "CN": ["zh"], // China - Chinese
    "CO": ["es"], // Colombia - Spanish
    "CR": ["es"], // Costa Rica - Spanish
    "HR": ["hr"], // Croatia - Croatian
    "CZ": ["cs"], // Czech Republic - Czech
    "DK": ["da"], // Denmark - Danish
    "DO": ["es"], // Dominican Republic - Spanish
    "EC": ["es"], // Ecuador - Spanish
    "EG": ["ar", "en"], // Egypt - Arabic, English
    "EE": ["et"], // Estonia - Estonian
    "FI": ["fi"], // Finland - Finnish
    "FR": ["fr"], // France - French
    "DE": ["de"], // Germany - German
    "GB": ["en"], // Great Britain - English
    "GR": ["el"], // Greece - Greek
    "GT": ["es"], // Guatemala - Spanish
    "HK": ["en", "zh"], // Hong Kong - English, Chinese
    "HU": ["hu"], // Hungary - Hungarian
    "IN": ["bn", "en", "hi", "kn", "mr", "ta"], // India - Bengali, English, Hindi, Kannada, Marathi, Tamil
    "ID": ["id"], // Indonesia - Indonesian
    "IE": ["en"], // Ireland - English
    "IL": ["en", "he"], // Israel - English, Hebrew
    "IT": ["it"], // Italy - Italian
    "JP": ["ja"], // Japan - Japanese
    "KE": ["en", "sw"], // Kenya - English, Swahili
    "KR": ["ko"], // Korea (South) - Korean
    "LV": ["lv"], // Latvia - Latvian
    "LT": ["lt"], // Lithuania - Lithuanian
    "LU": ["de"], // Luxembourg - German
    "MY": ["en", "ms"], // Malaysia - English, Malay
    "MX": ["es"], // Mexico - Spanish
    "MA": ["ar", "fr"], // Morocco - Arabic, French
    "NL": ["nl"], // Netherlands - Dutch (Flemish)
    "NZ": ["en"], // New Zealand - English
    "NG": ["en"], // Nigeria - English
    "NO": ["nb"], // Norway - Norwegian (Bokmål)
    "PA": ["es"], // Panama - Spanish
    "PH": ["en"], // Philippines - English
    "PL": ["pl"], // Poland - Polish
    "PT": ["pt"], // Portugal - Portuguese
    "QA": ["ar", "en"], // Qatar - Arabic, English
    "RO": ["ro"], // Romania - Romanian
    "SA": ["en", "ar"], // Saudi Arabia - English, Arabic
    "RS": ["sr"], // Serbia - Serbian
    "SG": ["en", "zh"], // Singapore - English, Chinese
    "SK": ["sk"], // Slovak Republic - Slovak
    "SI": ["sl"], // Slovenia - Slovenian
    "ZA": ["af", "en"], // South Africa - Afrikaans, English
    "ES": ["es"], // Spain - Spanish
    "SE": ["sv"], // Sweden - Swedish
    "CH": ["de", "fr", "it"], // Switzerland - German, French, Italian
    "TW": ["zh"], // Taiwan - Chinese
    "TH": ["th"], // Thailand - Thai
    "TR": ["tr"], // Turkey - Turkish
    "AE": ["ar", "en"], // United Arab Emirates - Arabic, English
    "US": ["en", "es"], // United States - English, Spanish
    "UY": ["es"], // Uruguay - Spanish
    "VN": ["vi"] // Viet Nam - Vietnamese
  }
  
  return countryLanguageMap[countrycodeZ] || []
}

// 根据语言代码获取语言信息
export const getLanguageBycode = (codeZ) => {
  return supportedLanguages.find(lang => lang.codeZ === codeZ)
}

// 获取所有语言选项
export const getAllLanguages = () => {
  return supportedLanguages
}
